package com.kaguya.vams.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 数字字典
 *
 * @author : kaguya
 * @date : 10:10 2021/8/10
 */
@Data
public class SysDict {

    private static final long serialVersionUID = 1L;

    //主键 id 自增
    @TableId(value = "id", type = IdType.AUTO)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "id不能为空")
    private Long id;

    //创建时间 mp自动填充
    @NotNull(message = "创建时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime created;

    //修改时间 mp自动填充
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updated;

    /**
     * 参数
     */
    @TableField(exist = false)
    private Map<String, Object> param = new HashMap<>();

    /**
     * 父级id
     */
    @TableField("parent_id")
    private Long parentId;

    /**
     * 名称
     */
    @TableField("name")
    private String name;


    /**
     * 值
     */
    @TableField("value")
    private String value;

    /**
     * 编码
     */
    @TableField("dict_code")
    private String dictCode;

    /**
     * 是否有子节点
     */
    @TableField(exist = false)
    private boolean hasChildren;

}
